﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:Microsoft.Media.CaptureClient.Sample"
    xmlns:converters="using:Microsoft.Media.CaptureClient.Sample.Converters">

    <Style TargetType="local:ProfileViewer">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="local:ProfileViewer">
                    <Border
                        Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}">
                        <Grid Margin="{TemplateBinding Padding}">
                            <Grid.Resources>
                                <converters:MediaRatioConverter x:Name="mediaRatioConverter"/>
                            </Grid.Resources>
                            <StackPanel>
                                <TextBlock Text="Capture Profile" Style="{ThemeResource SubheaderTextBlockStyle}" Margin="0,0,0,5"/>
                                <TextBlock Text="Audio" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,0,0,5"/>
                                <TextBlock Style="{ThemeResource BodyTextBlockStyle}" DataContext="{TemplateBinding AudioCaptureEncodingProfile}">
                                    <TextBlock.Inlines>
                                        <Run Text="{Binding Subtype}"/>
                                        <Run Text=" "/>
                                        <Run Text="{Binding ChannelCount}"/>
                                        <Run Text=" channel "/>
                                        <Run Text="{Binding SampleRate}"/>
                                        <Run Text="sample/sec "/>
                                        <Run Text="{Binding BitsPerSample}"/>
                                        <Run Text="bits/sample"/>
                                    </TextBlock.Inlines>
                                </TextBlock>
                                <TextBlock Text="Video" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,5,0,5"/>
                                <TextBlock Style="{ThemeResource BodyTextBlockStyle}" DataContext="{TemplateBinding VideoCaptureEncodingProfile}">
                                    <TextBlock.Inlines>
                                        <Run Text="{Binding Subtype}"/>
                                        <Run Text=" "/>
                                        <Run Text="{Binding FrameRate, Converter={StaticResource mediaRatioConverter}}"/>
                                        <Run Text="fps "/>
                                        <Run Text="{Binding Width}"/>
                                        <Run Text="x"/>
                                        <Run Text="{Binding Height}"/>
                                    </TextBlock.Inlines>
                                </TextBlock>
                                <TextBlock Text="Output Profile" Style="{ThemeResource SubheaderTextBlockStyle}" Margin="0,10,0,5"/>
                                <TextBlock Text="Audio" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,0,0,5"/>
                                <ItemsControl ItemsSource="{TemplateBinding AudioOutputEncodingProfiles}">
                                    <ItemsControl.ItemTemplate>
                                        <DataTemplate>
                                            <TextBlock Style="{ThemeResource BodyTextBlockStyle}">
                                                <TextBlock.Inlines>
                                                    <Run Text="{Binding Subtype}"/>
                                                    <Run Text=" "/>
                                                    <Run Text="{Binding ChannelCount}"/>
                                                    <Run Text=" channel "/>
                                                    <Run Text="{Binding SampleRate}"/>
                                                    <Run Text="sample/sec "/>
                                                    <Run Text="{Binding BitsPerSample}"/>
                                                    <Run Text="bits/sample "/>
                                                    <Run Text="{Binding Bitrate}"/>
                                                    <Run Text="bps"/>
                                                </TextBlock.Inlines>
                                            </TextBlock>
                                        </DataTemplate>
                                    </ItemsControl.ItemTemplate>
                                </ItemsControl>
                                <TextBlock Text="Video" Style="{ThemeResource TitleTextBlockStyle}" Margin="0,5,0,5"/>
                                <ItemsControl ItemsSource="{TemplateBinding VideoOutputEncodingProfiles}">
                                    <ItemsControl.ItemTemplate>
                                        <DataTemplate>
                                            <TextBlock Style="{ThemeResource BodyTextBlockStyle}">
                                                <TextBlock.Inlines>
                                                    <Run Text="{Binding Subtype}"/>
                                                    <Run Text=" "/>
                                                    <Run Text="{Binding FrameRate, Converter={StaticResource mediaRatioConverter}}"/>
                                                    <Run Text="fps "/>
                                                    <Run Text="{Binding Width}"/>
                                                    <Run Text="x"/>
                                                    <Run Text="{Binding Height}"/>
                                                    <Run Text=" "/>
                                                    <Run Text="{Binding Bitrate}"/>
                                                    <Run Text="bps "/>
                                                </TextBlock.Inlines>
                                            </TextBlock>
                                        </DataTemplate>
                                    </ItemsControl.ItemTemplate>
                                </ItemsControl>
                            </StackPanel>
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
